package cz.muni.fi.pa165.hauntedhouses.service;

import cz.muni.fi.pa165.hauntedhouses.dto.AbilityDTO;
import cz.muni.fi.pa165.hauntedhouses.dto.AbilityType;
import java.util.List;

/**
 *An interface for ability service layer
 * @author Petr Suchý (373947)
 */
public interface AbilityService {
    
    /** 
     * Checks if given Ability is correct and stores it into the DB
     *
     * @param ability ability entity we want to add to database
     * @throws IllegalArgumentException if entity itself or any of its attributes
     * is null or, in case of strings, empty. Also throws this exception in case the Ability has
     * already assigned ID.
     */
    void create(AbilityDTO ability);
    
    /** 
     * Checks if given Ability is correct and present in the DB and updates it in the DB.
     *
     * @param ability the ability we want to update
     * @throws IllegalArgumentException if entity itself or any of its attributes
     * is null or, in case of strings, empty.
     */
    void update(AbilityDTO ability);
    
    /**
     * Checks if given Ability is correct and present is the database, if so, this
     * Ability will be removed.
     *
     * @param ability the ability we want to remove
     * @throws IllegalArgumentException if entity itself or any of its attributes
     * is null or, in case of strings, empty.
     */
    void remove(AbilityDTO ability);
    
    /**
     * Returns a Ability from the DB based on its ID. If there is no Ability with
     * such ID, null is returned.
     *
     * @param id id of a Ability we want to search in the DB
     * @return null if there is no Ability with given ID, Ability otherwise
     * @throws IllegalArgumentException if id is null or < 0
     */
    AbilityDTO get(Long id);
    
     /**
      * Returns list of all the abilities in the DB. If there are no abilities, empty list
     * is returned
     *
     * @return List of all abilities. Empty list of there are no abilities.
     */
    List<AbilityDTO> findAll();
    
    /**
     * Returns list of all abilities filtered by their name, which is given as parametr.
     *
     * @param name name (or part of the name) of the abilities we want to search for
     * @return List of all abilities which name contains given String, empty list if no Ability contains it.
     * @throws IllegalArgumentException if given string is either null or empty
     */
    List<AbilityDTO> findByName(String name);
    
    /**
     * Returns list of all abilities filtered by their type, which is given as parametr.
     *
     * @param at ability type of the ability we want to search for
     * @return List of all abilities which name contains given String, empty list if no Ability contains it.
     * @throws IllegalArgumentException if given AbilityType is either null
     */
    List<AbilityDTO> findByType(AbilityType at);
    
    
}
